//
//  LoginViewController.m
//  项目
//
//  Created by 张诗雨 on 15/1/6.
//  Copyright (c) 2015年 张诗雨. All rights reserved.
//

#import "LoginViewController.h"
#import "UIImage+GaussianBlur.h"
@interface LoginViewController ()

@end

@implementation LoginViewController
- (void)dealloc
{
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view .backgroundColor = [UIColor whiteColor];
    [self createView];
    [self createButton];
}
- (void)createView
{
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame];
    UIImage *image = [UIImage imageWithBlurImageNamed:[UIImage imageNamed:@"loginback.jpg"] intputRadius:3.0f];
    imageView.userInteractionEnabled = YES;
    imageView.image = image;
    [self.view addSubview:imageView];
    [imageView release];
    
    UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
    view.backgroundColor = [UIColor blackColor];
    view.alpha = 0.3;
    [self.view addSubview:view];
    [view release];
    
    
    UIImageView *tengxun = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 280) / 2, 230, 60, 60)];
    tengxun.image = [UIImage imageNamed:@"tengxun.png"];
    [self.view addSubview:tengxun];
    [tengxun release];
    
    
    UIImageView *xinlang = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 280) / 2, 330, 60, 60)];
    xinlang.image = [UIImage imageNamed:@"xinlang.png"];
    [self.view addSubview:xinlang];
    [xinlang release];

    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 120) / 2, 60, 120, 120)];
    title.layer.cornerRadius = title.frame.size.width / 2;
    title.layer.masksToBounds = YES;
    title.backgroundColor = [UIColor whiteColor];
    title.textColor = [UIColor blackColor];
    title.textAlignment = NSTextAlignmentCenter;
    title.font = [UIFont boldSystemFontOfSize:30.0f];
    title.text = @"登录";
    [self.view addSubview:title];
    [title release];
}
- (void)createButton
{
    /// 返回按钮
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem];
    backButton.frame = CGRectMake(10, 20, 32, 32);
    [backButton setBackgroundImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
    
    UIButton *tengxu = [UIButton buttonWithType:UIButtonTypeSystem];
    tengxu.frame = CGRectMake((self.view.frame.size.width - 260) / 2 + 60, 230, 180, 60);
    tengxu.titleLabel.font = [UIFont boldSystemFontOfSize:23.0f];
    tengxu.titleLabel.textAlignment = NSTextAlignmentCenter;
    [tengxu setTitle:@"腾 讯 微 博" forState:UIControlStateNormal];
    [tengxu setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [tengxu.layer setMasksToBounds:YES];
    [tengxu.layer setCornerRadius:15.0];
    [tengxu.layer setBorderWidth:2.0];
    [tengxu.layer setBorderColor:[[UIColor whiteColor] CGColor]];
    [self.view addSubview:tengxu];
    
    UIButton *xinLang = [UIButton buttonWithType:UIButtonTypeSystem];
    xinLang.frame = CGRectMake((self.view.frame.size.width - 260) / 2 + 60, 330, 180, 60);
    xinLang.titleLabel.font = [UIFont boldSystemFontOfSize:23.0f];
    xinLang.titleLabel.textAlignment = NSTextAlignmentCenter;
    [xinLang setTitle:@"新 浪 微 博" forState:UIControlStateNormal];
    [xinLang setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [xinLang.layer setMasksToBounds:YES];
    [xinLang.layer setCornerRadius:15.0];
    [xinLang.layer setBorderWidth:2.0f];
    [xinLang.layer setBorderColor:[[UIColor whiteColor] CGColor]];
    [self.view addSubview:xinLang];
}
- (void)backButtonAction:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
